<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"></c:set> 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="shortcut icon" href="${ctx}/favicon.ico"> <link href="${ctx}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${ctx}/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="${ctx}/css/animate.css" rel="stylesheet">
    <link href="${ctx}/css/style.css?v=4.1.0" rel="stylesheet">
</head>
<body>
	
	    <div class="col-sm-8" style="margin-top: 5%;margin-left:18%;">
                <div class="panel panel-warning">
                    <div class="panel-heading">
                        <i class="fa fa-warning"></i>请谨慎选择要删除信息
                    </div>
                    <div class="panel-body" style="height:300px;">
                        <div style="width:100%;height:auto">
                                <label class="col-sm-2" style="margin-top:5px;">选择要删除的表：</label>
                                <div class="col-sm-5">
                                    <select class="form-control" name="tablelist">
                                        <option value="purchase_tb">采购表</option>
                                        <option value="goods_tb">商品表</option>
                                        
                                    </select>
                                </div>
                                <div class="btn btn-primary btn-rounded" onclick="deleteTable()">删除</div>
                        </div>                      
                        <div style="width:100%;height:auto;margin-top:15px;">
                                <label class="col-sm-2" style="margin-top:5px;">采购相关信息：</label>
                                <div class="col-sm-5">
                                    <select class="form-control" name="purchaseAbout">
                                        <option value="noInspect">未审核的采购信息</option>
                                        <option value="noInStorehouse">审核未入库的采购信息</option>
                                        <option value="inStroehouse">入库采购信息</option>
                                    </select>
                                </div>
                                <div class="btn btn-primary btn-rounded" onclick="deleteAboutPurchase()">删除</div>
                        </div>
                    </div>
                </div>
            </div>
	
</body>
<script src="${ctx}/dist\jquery\jquery.min.js"></script>
<script src="${ctx}/js/bootstrap.min.js?v=3.3.6"></script>
<script src="${ctx}/dist/layer-v3.1.1/layer/layer.js"></script>

<script>
	function deleteAboutPurchase() {
		if(confirm('确定删除所选吗？')){
		var values=$('[name=purchaseAbout]').val();
		alert(values);
		<c:if test="${values eq noInspect}">
			$.get('${ctx}/DeleteAboutServlet/deletNoInspect','',function(data){
				if(data){
					layer.msg("删除成功！");
				}else{
					layer.msg("删除失败！");
				}
			});
		</c:if>
		<c:if test="${values eq noInStorehouse}">
			$.get('${ctx}/DeleteAboutServlet/deletNoInStorehouse','',function(data){
				if(data){
					layer.msg("删除成功！");
				}else{
					layer.msg("删除失败！");
				}
			});
		</c:if>
		<c:if test="${values eq inStroehouse}">
			$.get('${ctx}/DeleteAboutServlet/deletInStorehouse','',function(data){
				if(data){
					layer.msg("删除成功！");
				}else{
					layer.msg("删除失败！");
				}
			});
		</c:if>
		}
	}
	function deleteTable(){
		if(confirm('确定删除所选吗？')){
		var values=$('[name=tablelist]').val();
		<c:if test="${values eq purchase_tb}">
			$.get('${ctx}/DeleteAboutServlet/deletPurchaseTb','',function(data){
				if(data){
					layer.msg("删除成功！");
				}else{
					layer.msg("删除失败！");
				}
			});
		</c:if>
		<c:if test="${values eq goods_tb}">
		$.get('${ctx}/DeleteAboutServlet/deletGoodsTb','',function(data){
			if(data){
				layer.msg("删除成功！");
			}else{
				layer.msg("删除失败！");
			}
		});
	</c:if>
		}
	}
</script>
</html>